package blhorse.TreadQue;

import java.util.concurrent.ArrayBlockingQueue;

public class Eat extends  Thread{
    ArrayBlockingQueue<String> queue;
    public Eat(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }
    @Override
    public void run() {
        while (true) {
            try {
                String food = queue.take();
                Thread.sleep(1000);
                System.out.println("正在吃" + food);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
